A magnetic sensor, such as a Hall element is widely applied in modern industries and electronic products to induce a magnetic field strength for measuring physical parameters such as current, position and direction. The motor is an important application field of magnetic sensor. The magnetic sensor may serve as a rotor magnetic-pole position sensor in the motor. As a Hall element is generally made of semiconductor material and a constant voltage is applied to the Hall element to drive the Hall element, a sensitivity of the Hall element changes apparently when a temperature changes.